/*
CREATE PROCEDURE SelectAllTeachers
AS
	SELECT * FROM TEACHERS ORDER BY SURNAME, NAME;

	
CREATE PROCEDURE SelectAllGroups
AS
	SELECT * FROM GROUPS ORDER BY COURSENUMBER, GroupNumber, Speciality, SubGroup;
*/

/*
CREATE PROCEDURE SelectAllSubjects
AS
	SELECT * FROM SUBJECTS ORDER BY NAME;


CREATE PROCEDURE SelectAllClassRoomTypes
AS
	SELECT * FROM CLASSROOMTYPES ORDER BY NAME;
*/

CREATE PROCEDURE SelectAllClassRooms
AS
	Select CLASSROOMS.ID, CLASSROOMS.NUMBER, CLASSROOMTYPES.NAME 
	from CLASSROOMS, CLASSROOMTYPES 
	WHERE
	CLASSROOMS.CTYPE = CLASSROOMTYPES.ID ORDER BY NUMBER;


Create PROC SelectLessonsInformation as
(
SELECT	LESSONS.ID, SUBJECTS.ID, SUBJECTS.NAME, TEACHERS.ID, TEACHERS.SURNAME, TEACHERS.NAME, 
		TEACHERS.PATRONYMIC, GROUPS.ID, GROUPS.CourseNumber, GROUPS.Speciality, 
		GROUPS.GroupNumber, GROUPS.SubGroup, CLASSROOMTYPES.ID, CLASSROOMTYPES.NAME
FROM	SUBJECTS, TEACHERS, GROUPS, CLASSROOMTYPES, LESSONS 
WHERE	SUBJECTS.ID = LESSONS.SUBJECT_ 
		AND
		TEACHERS.ID = LESSONS.TEACHER_ 
		AND
		GROUPS.ID = LESSONS.GROUP_ 
		AND
		CLASSROOMTYPES.ID = LESSONS.CLRT_ 
)

